/*
 * Project it.battlehorse.rcp.tools.commons
 * Created on Nov 18, 2005
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * A copy of the LGPL is available also at
 * http://www.gnu.org/copyleft/lesser.html
 * 
 */ 
package it.battlehorse.rcp.tools.commons;

import org.eclipse.jface.resource.ImageDescriptor;

/**
 * An enumeration describing the possible severity levels.
 * 
 * @author battlehorse
 * @since Nov 18, 2005
 */
public enum Severity {

	/**
	 * A Trace severity level. Use it to describe non-relevant informations
	 */
	TRACE ( "Trace" , CommonsActivator.getImageDescriptor("resources/severity_trace.png")),
	
	/**
	 * An Info level. Use it to describe commons informations
	 */
	INFO ( "Info", CommonsActivator.getImageDescriptor("resources/severity_info.png")) ,
	
	/**
	 * A Warning level. Use it to describe important informations which are not critical
	 */
	WARNING ( "Warning",CommonsActivator.getImageDescriptor("resources/severity_warning.png")) ,
	
	/**
	 * An Error level. Use it to describe critical problems and application errors
	 */
	ERROR ( "Error", CommonsActivator.getImageDescriptor("resources/severity_error.png")) ;
	
	/* The message which describes the severity level */
	private String message;
	
	private ImageDescriptor imageDesc;
	
	/**
	 * Creates a new instance of the class
	 * 
	 * @param message the describing message
	 * @param imageDesc the associated image
	 */
	Severity(String message, ImageDescriptor imageDesc) {
		this.message = message;		
		this.imageDesc = imageDesc;
	}
	
	/**
	 * Returns a message which describes the severity level
	 * 
	 * @return a message which describes the severity level
	 */
	public String getMessage() {
		return message;
	}
	
	/**
	 * Returns an image which can be associated with this severity level
	 * 
	 * @return an image which can be associated with this severity level
	 */
	public ImageDescriptor getImageDescriptor() {
		return imageDesc;
	}
	
	/**
	 * Returns the image key to be used in conjunction with Image registries
	 * 
	 * @return the image key to be used in conjunction with Image registries
	 */
	public String getImageKey() {
		return "tools.rcp.log." + getMessage().toLowerCase();
	}
}
